import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/home',
    name: 'Home',
    component: Home,
    children:[
      {
        path:'index',
        name:'index',
        component: () => import('../views/index.vue')
      },
      {
        path: 'cart',
        name: 'cart',
        component: () => import('../views/cart.vue'),
        meta: {
          keepAlive: true
        }
      },
      {
        path:'/home',
        redirect:'/home/index'
      }
    ]
  },
  {
    path:'/',
    redirect:'/home'
  }
]

const router = new VueRouter({
  routes
})

export default router
